Salesforce UX API
TMF-687 Interface to inform pick-up is done
This operation is used to inform Asset pick-up is done from Service Center ( B2BSoft will be informed of stock movement using TransactionId ) (SF --> ESB --> B2BSoft)
URL
https://[localhost]:[port]/sfdc-ux/v1/{businessId}/productStock/{id}
Param
name | type | description | required |
---|---|---|---|
businessId | string | 2 letter ISO 3166 country code (TT, BB, JM, PA, PR etc.) identifying the business unit. Expected one is "PR" | Y |
id | string | Original transaction ID for the call center payment collection (Call centre payment collected transactionID from POS) | Y |
Header
name | value | description | required |
---|---|---|---|
client_id | string | The client_id identifying the channel. | Y |
client_secret | string | Password associated with the client_id. | Y |
X-Correlation-ID | string | Identifier that correlates HTTP request between a client and server. Any identification model (UUDI, checksum, etc.) can be used, as long as it is a unique value to differentiate a transaction. | Y |
cURL Request
curl --location --request PATCH 'https://nonprod.esb.cloud.lla.com/sfdc-ux/sfdc-ux/v1/PR/productStock/1234' \
--header 'X-Correlation-ID: f058ebd63456723' \
--header 'client_id: 12345' \
--header 'client_secret: abcde' \
--header 'Content-Type: application/json' \
--data-raw '{
"description": "pick-up is done, stock moved out of the store",
"stockLevelCategory": "pickupTransaction",
"channel": [
{
"id": "SFDC-B2C"
}
],
"stockedProduct": {
"productCharacteristic": [
{
"name": "posDocumentId",
"valueType": "string",
"value": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
},
{
"name": "products",
"valueType": "array",
"value": [
{
"sku": "652810501996",
"quantity": 2,
"serials": [
"45653476457871",
"45653476457867"
],
"sapReservationId ": "3fa85f64-5717-4562-b3fc-2c96"
}
]
}
],
"relatedParty": [
{
"name": "<username>",
"role": "user",
"@referredType": "Customer"
},
{
"id": "13",
"role": "Dealer",
"@referredType": "Organization"
}
]
}
}'
Definitions
Each of the request parameters is detailed.
FYI, Y - Mandatory & N - Optional
name | type | description | required |
---|---|---|---|
description | string | Free-text description of the ProductStock | N |
stockLevelCategory | string | Category of the ProductStock | N |
channel | array | The channel to which the resource reference to. | N |
channel.id | string | Channel name | N |
stockedProduct | object | Asset stock moment details | Y |
stockedProduct.productCharacteristic | array | Describes a given characteristic of an object or entity through a name/value pair. Please refer below 'productCharacteristic' table for more details | Y |
stockedProduct.productCharacteristic.name | string | Name of the characteristic | Y |
stockedProduct.productCharacteristic.value | any | Value of the characteristic | Y |
stockedProduct.productCharacteristic.valueType | string | Data type of the value of the characteristic | N |
stockedProduct.relatedParty | array | Related Entity reference Please refer below 'RelatedParty' table for more details | Y |
stockedProduct.relatedParty.name | string | Name of the related entity. | Y |
stockedProduct.relatedParty.role | string | Role played by the related party | Y |
stockedProduct.relatedParty.@referredType | string | The actual type of the target instance | N |
productCharacteristic Values
Characteristic name | type | description | required |
---|---|---|---|
posDocumentId | string | DocumentID received from POS during the reservation of items (Reservation API) | Y |
products | array | Products Array | Y |
products.sku | string | SKU of the product | Y |
products.quantity | int | Quantity of the products | Y |
products.serials | array | Array of serial numbers of the product. Mandatory in case of serialized products | Y* |
products.sapReservationId | string | Reservation ID from SAP (itemise at the product level) | Y |
RelatedParty Values
RelatedParty name | type | description | required |
---|---|---|---|
userName | string | Username from SF and will be mapped to userId internally. | Y |
dealerCode | string | Dealer Code | Y |
Possible response success
This section defines all the possible data structures received by the client and that must be considered satisfactory at the time of responding to the method.
[ 200 ]
OK - updateResource request processed successfully, response body contains an entity corresponding to the requested resource.
{
"stockedProduct": {
"productCharacteristic": [
{
"name": "transactionID",
"valueType": "string",
"value": "79231"
}
]
},
"productStockLevel": { //this is not coming from backend, as TMF it's mandatory so passing as static value
"amount": 1,
"units": "none"
}
}
Definitions
Each of the request parameters is detailed.
name | type | description | required |
---|---|---|---|
stockedProduct | object | Asset stock moment details | N |
productCharacteristic | array | Describes a given characteristic of an object or entity through a name/value pair. Please refer below 'productCharacteristic' table for more details | N |
productCharacteristic.name | string | Name of the characteristic | N |
productCharacteristic.value | any | Value of the characteristic | N |
productCharacteristic.valueType | string | Data type of characteristic | N |
productStockLevel | object | Product stock level info Note - This details not coming from backend system, is mandatory as per TMF data model this object is mandatory. Due this mapping static values in property file. | N |
productStockLevel.amount | number | Numeric value in a given unit | N |
productStockLevel.units | string | Unit | N |
Possible response error
In this section all the possible data structures received by the client are defined and that must be considered as unsatisfactory when responding to the method.
[ 400 ]
Bad Request - the request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.
{
"errors" : [{
"code" : 400,
"message" : "The request is invalid or not properly formed.",
"description" : "Please validate the request as it is invalid or not properly formed"
}]
}
[ 401 ]
Unauthorized - The request has not been applied because it lacks valid authentication credentials for the target resource.
{
"errors" : [{
"code" : 401,
"message" : "The user could not be authenticated for this request.",
"description" : "The request has not been applied because it lacks valid authentication credentials for the target resource"
}]
}
[ 403 ]
Forbidden - Indicates that the server understood the request but refuses to fulfill it. If authentication credentials were provided in the request, the server considers them insufficient to grant access. The client SHOULD NOT automatically repeat the request with the same credentials. The client MAY repeat the request with new or different credentials.
[ 404 ]
Not Found - server has not found a resource with that URI. This may be temporary and permanent condition. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.
{
"errors" : [{
"code" : 404,
"message" : "Requested resource not found",
"description" : "The requested operation failed because a resource associated with the request could not be found."
}]
}
[ 405 ]
Method Not Allowed - HTTP method not allowed for this resource. The method specified in the Request-Line is not allowed for the resource identified by the Request-URI.
{
"errors": [{
"code": 405,
"message": "APIKIT:METHOD_NOT_ALLOWED",
"description": "HTTP Method post not allowed for : /{businessId}/productStock/XXX"
}]
}
[ 500 ]
Internal Server Error - server encountered an error processing request. This should not happen normally, but it is a generic error message, given when no more specific message is suitable.
{
"errors" : [{
"code" : 500,
"message" : "The request failed due to an internal error.",
"description": "The request failed due to an internal error."
}]
}
[ 502]
Bad Gateway - gateway is available but backend service is not. The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.
[ 503 ]
Service Unavailable - temporary maintenance of service, try again later. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay will be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response. Note: The existence of the 503 status code does not imply that a server will use it when becoming overloaded. Servers may simply refuse the connection.
Retry-After: 120